#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QFileDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    mFBXViewerWidget = new FBXViewerWidget();
    mFBXViewerWidget->setDefaultTexturePath(QCoreApplication::applicationDirPath()+"/cottage_diffuse.png");
    ui->verticalLayout_2->addWidget(mFBXViewerWidget);
}

MainWindow::~MainWindow()
{
    delete ui;
    delete mFBXViewerWidget;
    mFBXViewerWidget = nullptr;
}


void MainWindow::on_pushButton_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this,
                                                    "Open FBX File", "", "FBX Files (*.fbx)");

    if (!fileName.isEmpty()) {
        mFBXViewerWidget->loadFBXFile(fileName);
        //mFBXViewerWidget->createTestTriangle();
    }
}

